﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using JX.Core;
using JX.Core.Entity;

namespace JX.Core
{
	/// <summary>
	/// 数据库表：Company 的仓储接口.
	/// </summary>
	public partial interface ICompanyRepositoryDapper : IRepositoryDapper<CompanyEntity>
	{
		#region 是否存在扩展数据
		/// <summary>
		/// 是否存在扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="tableName"></param>
		/// <returns></returns>
		bool IsExistDataOption(int id, string tableName = "U_CompanyText");
		/// <summary>
		/// 是否存在扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="tableName"></param>
		/// <returns></returns>
		Task<bool> IsExistDataOptionAsync(int id, string tableName = "U_CompanyText");
		#endregion

		#region 添加扩展数据
		/// <summary>
		/// 添加扩展数据:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool AddDataOption(string tableName, CompanyEntity entity);
		/// <summary>
		/// 添加扩展数据:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> AddDataOptionAsync(string tableName, CompanyEntity entity);
		#endregion

		#region 修改扩展数据
		/// <summary>
		/// 修改扩展表数据，不存在则添加:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool UpdateDataOption(string tableName, CompanyEntity entity);
		/// <summary>
		/// 修改扩展表数据，不存在则添加:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> UpdateDataOptionAsync(string tableName, CompanyEntity entity);
		#endregion

		#region 删除扩展数据
		/// <summary>
		/// 删除扩展数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="id"></param>
		/// <returns></returns>
		bool DeleteDataOption(string tableName, int id);
		/// <summary>
		/// 删除扩展数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="id"></param>
		/// <returns></returns>
		Task<bool> DeleteDataOptionAsync(string tableName, int id);
		#endregion

		#region 得到扩展数据
		/// <summary>
		/// 根据主键得到扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		DataTable GetDataOption(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		/// <summary>
		/// 根据主键得到扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		Task<DataTable> GetDataOptionAsync(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		#endregion

		#region 得到公司成员
		/// <summary>
		/// 根据主键得到公司成员
		/// </summary>
		/// <param name="id">公司ID</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		DataTable GetMemberInfo(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		/// <summary>
		/// 根据主键得到公司成员
		/// </summary>
		/// <param name="id">公司ID</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		Task<DataTable> GetMemberInfoAsync(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		#endregion
	}
}